<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/jquery-1.11.3.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="../css/resign.css">
    <link rel="stylesheet" href="../font/iconfont.css">
</head>
<body>
    <!-- header -->
    <header>
        <div class="container">
            <div class="row clearfix">
                <div class="col-md-6 column">
                    <a href="index.html"><img src="../image/logo.jpg" alt=""></a><p>欢迎登陆</p>
                </div>
                <div class="col-md-6 column">
                    
                </div>
            </div>
        </div>
    </header>

    <section id="container">
        <div class="container">
            <img src="../image/login1.png" alt="">
            <div class="row clearfix">
        	    <div class="col-md-6 column">
                    <h2>神舟会员</h2>
                    <div>
                        <p><input type="text" placeholder="1111" id="username"></p>
                        <p><input type="text" placeholder="111aA!" id="password" ></p>
                        <p><input type="checkbox" name="" id="">&nbsp&nbsp自动登录</p>
                        <button id="btn">登录</button>
                    </div>
                    <p>忘记密码>><span class="register">立即注册>></span></p>
                    <p>使用合作账号登录</p>
                    <a><span class="iconfont icon-qq"></span><span class="iconfont icon-weibo" style="margin-left: 37px;"></span></a>
                </div>
                
            </div>
        </div>
    </section>
    
    <!-- footer -->
    <footer>
        <div>
            <p>
                <a href="javascript:;">公司简介</a>|
                <a href="javascript:;">加入我们</a>|
                <a href="javascript:;">联系我们</a>
                All rights reserved © 2015 Hasee 粤ICP备11003995
            </p>
        </div>
    </footer>

    <script>
        //注册页面
        $('.register').click(function name(params) {
            location.href = 'login.html'
        })

        //登录按钮
         $('#btn').click(function(){
            $.ajax({
                url:'http://jx.xuzhixiang.top/ap/api/login.php',
                type:'get',
                data:{username:$('#username').val(),password:$('#password').val()}
            }).then(res=>{
                console.log(res);
                alert(res.msg)
                if(res.code==1){
                    localStorage.setItem('token',res.data.token)
                    localStorage.setItem('username',res.data.username)
                    localStorage.setItem('id',res.data.id)
                    location.href='../index.html'
                }
                
            })
        })
    </script>
</body>
</html>